// 对背景图片进行缓存
document.execCommand("BackgroundImageCache", false, true);

// 共用的头部标签, 利用字符串输出每个页面头部共用的标签(注意父子级关系)
var header = "<div class=\"header\">"+
				"<a href=\"index.html\"><img src=\"img/logo.jpg\"/></a>"+
				"<div class=\"header_main\">"+
					"<div class=\"header_top\">"+
						"<span id='lanMark'>中国</span>"+
						"<div class=\"header_top_right\">"+
							"<select name=\"language\" onchange='selChange(this)'>"+
								"<option value=\"\" class='lanOp'>选择语言</option>"+
								"<option value=\"英文\" class='lanOp'>英文</option>"+
								"<option value=\"中文\" class='lanOp'>中文</option>"+
							"</select>"+
							"<a id='enterInfo' href=\"#\">进入全球官网</a>"+
						"</div>"+
					"</div>"+
					"<div class=\"header_bottom\">"+
						"<ul>"+
							"<li><a href=\"news.html\">新闻动态</a></li>"+
							"<li onmouseenter='footD()' onmouseleave='footU()'><a href=\"menu.html\">美食与营养</a></li>"+
							"<li><a href=\"development.html\">加盟流程</a></li>"+
							"<li><a href=\"about.html\">关于我们</a></li>"+
							"<li><a href=\"#\">快餐店位置查询</a></li>"+
						"</ul>"+
					"</div>"+
				"</div>"+
				"<ul onmouseleave='footU()' onmouseenter='footD()' id=\"drop_menu\" class=\"drop-menu\"><li><a>超值 Value</a></li><li><a>经典 Classics</a></li><li><a>精选 Premium</a></li><li><a>低脂 Low Fat</a></li><li><a>百味卷 Warp</a></li><li><a>沙拉 Salad</a></li><li><a>聚餐服务 Catering</a></li><li><a>饮料和小食 Drinks & Sides</a></li><li><a>早餐 Breakfast</a></li><li><a>营养 Nutrition</a></li><li><a>如何点餐 How To Order</a></li></ul>"
			+ "</div>"
			

var footer=	"<div class=\"footer\">"+
				"<div class=\"footer_top\">"+
					"<a href=\"#\" class=\"img1\"></a>"+
					"<a href=\"#\" class=\"img2\"></a>"+
					"<a href=\"#\" class=\"img3\"></a>"+
					"<a href=\"#\" class=\"img4\"></a>"+
					"<a href=\"#\" class=\"img5\"></a>"+
					"<img src=\"img/code.png\" class=\"code\"/>"+
				"</div>"+
				"<div class=\"footer_bottom\">"+
					"<ul class='footer_bottom_ulOne'>"+
						"<li><a href=\"#\">主页</a></li>"+
						"<li><a href=\"#\">菜单/营养</a></li>"+
						"<li><a href=\"#\">如何加盟</a></li>"+
						"<li><a href=\"#\">关于我们</a></li>"+
						"<li><a href=\"#\">快餐店位置查询</a></li>"+
					"</ul>"+
					"<ul class='footer_bottom_ulTwo'>"+
						"<li><a href=\"#\">联系我们</a></li>"+
						"<li><a href=\"#\">使用条款</a></li>"+
						"<li><a href=\"#\">隐私权政策</a></li>"+
						"<li><a href=\"#\">SUBWAY Partners</a></li>"+
					"</ul>"+
					"<p>SUBWAY® is a Registered Trademark of Subway IP Inc.®2016 Subway IP Inc.</p>"+
				"</div>"+
			"</div>"

function footD(){
	document.getElementById("drop_menu").style.display = "block";
}
function footU(){
	document.getElementById("drop_menu").style.display = "none";
}

window.onload = function(){
	var theUL = document.getElementById("drop_menu");
	var liArr = theUL.getElementsByTagName("li");
	for (var i = 0; i < liArr.length; i++){
		(function(ind){
			liArr[ind].onclick = function(){
				console.log(123);
				localStorage.footIndex = ind;
			}
		})(i);
	}
}
function selChange(obj){
	var nowV = localStorage.lan; //取出当前语言
	if (obj.value != "Select Language" && obj.value != "选择语言" && nowV != obj.value){
		localStorage.lan = obj.value;
		location.reload();
	}
}
